{% extends 'AppDashboardBundle::layout2.html.twig' %}

{% block stylesheets %}
  {{ parent() }}
{% endblock %}

{% block javascripts %}      
  {{ parent() }}
<script>
  
$( document ).ready(function() { 
  $( ".datepicker" ).datepicker({ dateFormat: "yy-mm-dd" });
  if($("table.sortable").length>0)
    $("table.sortable").dataTable({
      iDisplayLength:25,
      aLengthMenu:[5,10,25,50,100],
      sPaginationType:"full_numbers",
      aoColumns:[{bSortable:false},null,null,null,null,null,null]
      });
});
  
</script>
</script>
{% endblock %}

{% block content %}
<div class="row"> 
  <div class="col-md-12"> 
    <ol class="breadcrumb"> 
      <li><a href="#">Нүүр</a></li> 
      <li><a href="#">Бүтээгдэхүүн</a></li> 
      <li class="active">Жагсаалт</li> 
    </ol> 
  </div> 
</div>
<div class=row> 
  <div class=col-md-12> 
    <div class=block> 
      
        <div class=header> 
          <h2>Бүтээгдэхүүнүүд</h2> 
          <div class="col-md-1 right text-right"><a class="btn btn-success" href="{{ path('product_new') }}">Create a new entry</a></div>
        </div>
      
        <div class=content style="margin: 1px 0;"> 
        <table cellpadding=0 cellspacing=0 width=100% class="table table-bordered table-striped sortable">  
          <thead>
            <tr>
                <th>Нэр</th>
                <th>Төрөл</th>
                <th>Үүсгэсэн огноо</th>
                <th>Төлөв</th>
                <th>Үүсэл гарал</th>
                <th>Үйлдвэрлэсэн огноо</th>
                <th>Үйлдэлүүд</th>
            </tr>
            </thead>
            <tbody>
            {% for entity in entities %}
                <tr>
                    <td><a href="{{ path('product_show', { 'id': entity.id }) }}">{{ entity.name }}</a></td>
                    <td>{{ entity.type }}</td>
                    <td>{% if entity.createdDate %}{{ entity.createdDate|date('Y-m-d H:i:s') }}{% endif %}</td>
                    <td>{% if entity.isActive == 1%}Идэвхитэй{%else%}Идэвхигүй{%endif%}</td>
                    <td>{{ entity.source }}</td>
                    <td>{% if entity.madeInDate %}{{ entity.madeInDate|date('Y-m-d H:i:s') }}{% endif %}</td>
                    <td>
                        <ul>
                            <li>
                                <a href="{{ path('product_show', { 'id': entity.id }) }}">show</a>
                            </li>
                            <li>
                                <a href="{{ path('product_edit', { 'id': entity.id }) }}">edit</a>
                            </li>
                        </ul>
                    </td>
                </tr>
            {% endfor %}
            </tbody>
        </table> 
        </div>
    </div> 
  </div> 
</div> 
{% endblock %}

